﻿using DayuCode.Designer;
using DayuCode.Designer.BLL;
using Sunny.UI;

namespace DayuCode.Designer
{
    public partial class FormLogin : UILoginForm
    {
        public FormLogin()
        {
            InitializeComponent();
        }

        private void FLogin_ButtonLoginClick(object sender, System.EventArgs e)
        {
            //UserName就是封装了界面里用户名输入框的值
            //Password就是封装了界面里密码输入框的值
            //if (UserName == "admin" && Password == "admin")
            string userName = UserName.Trim();
            var userData = LoginUserManager.Login(userName, Password);
            if (userData != null && userData.LoginId != null)
            {
                IsLogin = true;
                AppInstance.Author = userName;
                Close();
            }
            else
            {
                ShowErrorTip("用户名或者密码错误。");
                //ShowErrorTip("请输入用户名。");
            }
        }
    }
}